package com.infinit.selfhelp.common

import org.joda.time.format.DateTimeFormat
import org.joda.time.format.DateTimeFormatter
import org.joda.time.format.DateTimeFormatterBuilder

const val API_DATE_FORMAT_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
const val FIREBASE_DATE_FORMAT_PATTERN = "dd-MM-yyyy HH:mm"
const val NORMAL_DATE_FORMAT_PATTERN = "yyyy-MM-dd HH:mm:ss"
const val TRAVEL_DATE_FORMAT_PATTERN = "dd-MM-yyyy"
const val DOB_DATE_FORMAT_PATTERN = "yyyy-MM-dd"
const val DATE_FORMAT_PATTERN = "dd/MM/yyyy"
const val API_DATE_FORMAT_PATTERN1 = "yyyy-MM-dd'T'HH:mm:ssZ"
val dateFormats: DateTimeFormatter = DateTimeFormatterBuilder()
    .append(
        null,
        arrayOf(
            DateTimeFormat.forPattern(API_DATE_FORMAT_PATTERN).parser,
            DateTimeFormat.forPattern(NORMAL_DATE_FORMAT_PATTERN).parser,
            DateTimeFormat.forPattern(FIREBASE_DATE_FORMAT_PATTERN).parser,
            DateTimeFormat.forPattern(TRAVEL_DATE_FORMAT_PATTERN).parser,
            DateTimeFormat.forPattern(DOB_DATE_FORMAT_PATTERN).parser,
            DateTimeFormat.forPattern(DATE_FORMAT_PATTERN).parser,
            DateTimeFormat.forPattern(API_DATE_FORMAT_PATTERN1).parser
        )
    ).toFormatter()
